﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

using ValidationFramework.Reflection;

namespace ValidationFramework.Tests.Reflection.Extensions
{
    public class TypeExtensions
    {
        [TestFixture]
        public class ContainsProperty
        {
            public class Car
            {
                public string Model { get; set; }
            }
            [Test]
            public void Should_Return_True_When_Type_Has_A_Property_With_Matching_Name()
            {
                Assert.IsTrue(typeof(Car).ContainsProperty("Model"));
            }
            [Test]
            public void Should_Return_False_When_No_Property_By_The_Given_Name_Is_Found()
            {
                Assert.IsFalse(typeof(Car).ContainsProperty("Test"));
            }
            [Test]
            public void Should_Ignore_Property_Name_Case()
            {
                Assert.IsTrue(typeof(Car).ContainsProperty("Model"));
                Assert.IsTrue(typeof(Car).ContainsProperty("model"));
                Assert.IsTrue(typeof(Car).ContainsProperty("MoDeL"));
            }
        }

    }
}
